import json
import numpy as np
from fastdtw import fastdtw
from scipy.spatial.distance import euclidean

def read_and_convert_to_numpy(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        data = file.readlines()
    points = []
    for line in data:
        # Parse the JSON data to extract the points
        point_data = json.loads(line)
        point = point_data['point']
        points.append(point)
    
    return np.array(points)

file_path = 'test16.txt'  # Adjust the file path as needed
points_array = read_and_convert_to_numpy(file_path)
dt = 0.02
timelist = np.arange(0.0, points_array.shape[0] * dt, dt)
print(points_array.shape)
print(timelist.shape)
np.save('myend16.npy',points_array)